/**
 * @(#)TaskActionResultEnum.java 2016年11月20日
 * Copyright(C) 2016 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 执行任务状态
 * 
 * @author <a href="mailto:xupengcheng@zhexinit.com" >徐鹏程</a>
 * @version 1.0.0
 */
public enum TaskStatusEnum {
	FAIL(0, "失败"), 
	SUCCESS(1, "成功"), 
	QUEUE_OUT_OF_RANGE(2, "队列容量不够"), 
	HAS_DO(3, "已经执行过"), 
	LOGIN_OVER(4, "登录配置超量"), 
	EXEC_OVER(5, "执行量大于设置量"),
	LOGIN_PARAM_ERROR(7,"登录参数没有配置"),
	APK_TASK_PARAM_ERROR(8,"任务参数没有配置"),
	PARAM_ERROR(9,"参数不满足"),
	HAVE_NO_SIMULATOR(10,"模拟器不够"),
	HAVE_NO_APK(11,"没有可用包"),
	EXECING(12,"执行中"),
	FINISHED(13,"执行完成"),
	NOT_DONE(14, "没有做过"), 
	NONE(99,"未知错误"),
	
	SDK_MAX_LIMIT(1000, "最大限制"), 
	CLIENT_INFO_ERROR(1001, "客户端信息错误"), 
	APK_INFO_ERROR(1002, "APK错误"), 
	SDK_INFO_ERROR(1003, "SDK错误"),
	NO_APK_ERROR(1004, "没有获取到apk或者可用apk都已经做过任务"),
	PROVINCE_ERROR(1005, "省份信息错误"),
	SDK_INFO_EMPTY(1006, "用户信息错误"),
	NONE_USEFUL_APK(1007, "没有可用apk"),
	CARRIER_NO_SUPPORT(1008, "运营商不支持"),
	ALL_APK_FINSHED(1009, "所有APK任务都做完了"),
	SMS_TIMES_LIMIT(1010, "用户发送次数限制"),
	NO_PHONENUM(1011, "没有获取到手机号"),
	SDK_CARRIER_ERROR(1012, "登录用户必须是移动"),
	LOGIN_TYPE_LIMIT(1013, "登录量满了"),
	NO_LOGIN_TYPE(1014, "没有可用登录类型"),
	SDK_HAS_MOBILE(1015, "sdk登录有手机号码的不用"),
	;
	private int type;
	private String name;

	private TaskStatusEnum(int type, String name) {
		this.type = type;
		this.name = name;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	private static Map<Integer, TaskStatusEnum> map = new HashMap<Integer, TaskStatusEnum>();

	static {
		for (TaskStatusEnum statusEnum : TaskStatusEnum.values()) {
			map.put(statusEnum.type, statusEnum);
		}
	}

	public static TaskStatusEnum valueOf(int type) {
		return map.get(type);
	}

	public static Map<Integer, TaskStatusEnum> getMap() {
		return map;
	}
}
